home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / SYMBMATH.H06 < prev    next >
Text File  |  1994-03-29  |  10KB  |  245 lines

  1.         3.1.5.  Functions, Procedures and Rules
  2.     These are two types of functions: internal and external. The
  3. internal function is compiled into the SymbMath system. The external
  4. function is the library written in SymbMath language, which is 
  5. automately loaded when it is needed. (See Chapter 3.4 Library and Package).
  6. The usage of both types are the same. You can change the property or name
  7. of the external function by modifying its library file, or you add a new 
  8. external function by creating its library file, but you cannot change the 
  9. internal function.
  10.  
  11.         3.1.5.1  Standard Mathematical Functions
  12.      Different versions of SymbMath have different number of
  13. standard mathematical functions. The Advanced Version C has all of them.
  14. See the following table in detail for other versions. All below standard
  15. functions, (except for random(x), n!, fac(n) and atan2(x,y)), can be 
  16. differentiated and integrated symbolically.
  17.  
  18.      Table 3.1.5.1  Standard Mathematical Functions
  19. -----------------------------------------------------------------------
  20. Functions       Meanings
  21.  
  22. random(x)       generate a random number.
  23. n!              factorial of n.
  24. fac(n)          the same as n!.
  25. sqrt(x)         square root, the same as x^0.5.
  26. root(x,n)       all n'th root of x.
  27. exp(x)          the same as e^x.
  28. sign(x)         1 when re(x) > 0, or both re(x) = 0 and im(x) > 0; 0 when
  29.         x=0; -1 otherwise.
  30. abs(x)          absolute value of x.
  31. ln(x)           natural logarithmic function of x, based on e.
  32. log10(x)
  33. sin(x)          sine function of x.
  34. cos(x) 
  35.  
  36. ............... above functions in Shareware Version A ...............
  37.  
  38. tan(x) 
  39. csc(x) 
  40. sec(x) 
  41. cot(x) 
  42. asin(x)         arc sine function of x, the inverse of sin(x).
  43. acos(x) 
  44. atan(x)
  45. acot(x)
  46. asec(x)
  47. acsc(x)
  48. atan2(x,y)      the radian angle of (x,y).
  49.  
  50. ............... above functions in Student Version B .................
  51.  
  52. sinh(x)         hyerbolic sine function of x.
  53. cosh(x) 
  54. tanh(x) 
  55. csch(x) 
  56. sech(x) 
  57. coth(x)
  58. asinh(x)        arc hyerbolic sine function of x, the inverse of sinh(x).
  59. acosh(x) 
  60. atanh(x)
  61. acoth(x)
  62. asech(x)
  63. acsch(x)
  64.  
  65. --------------------------------------------------------------------------
  66.  
  67.  
  68.         3.1.5.2  Calculus Functions 
  69.     Calculus functions are for calculus calculation. The first 
  70. arguement of the function is for evaluation, and the second arguement
  71. is a varilable that is with repsect to.
  72.  
  73.         Table 3.1.5.2       Calculus Functions
  74. ----------------------------------------------------------------------
  75. Functions       Meanings
  76.  
  77. subs(y, x = x0)      evaluates y when x = x0.
  78. lim(y, x = x0)          gives the limit of y when x approaches x0.
  79.             Note that the correct answers usually for the 
  80.             indeterminate forms: 0/0, inf/inf, 0*inf, 0^0, 
  81.             inf^0.
  82.  
  83. d(y, x)         differentiate y with respect to x.
  84. d(y, x, order)  gives the nth order derivative of y with respect to an 
  85.         undefined variable x.
  86. d(y)            implicit differentiation.
  87.  
  88. inte(y, x)      find the indefinite integral of y with respect to an
  89.         undefined variable x.
  90. inte(y,x,a,b)   find the definite integral of y with respect to an 
  91.         undefined variable x taken from x=a to x=b.
  92. inte(y,x,a,b,c)   find the definite integral of y with respect to an 
  93.         undefined variable x taken from x=a to x=b, then to x=c,
  94.         where b is singularity.
  95. inte(y, x from a to b)  the same as inte(y,x,a,b).
  96. inte(y)         implicit integration, used to integrate the 
  97.         differential equations.
  98.  
  99. dsolve(y'(x)=f(x,y), y(x), x)         solve differential equations.
  100.  
  101. sum(y, x from xmin to xmax)             sum of y step=1.
  102. sum(y, x from xmin to xmax step dx)     sum of y.
  103.  
  104. prod(y, x from xmin to xmax)            product of y step=1.
  105. prod(y, x from xmin to xmax step dx)    product of y.
  106. ---------------------------------------------------------------------
  107.  
  108.     If a second argument x is omitted in the functions d(y) 
  109. and inte(y), they are implicit derivatives and integrals. If f(x) is 
  110. undefined, d(f(x), x) is differentiation of f(x). These are useful 
  111. in the differential and integral equations. (see later chapters).
  112.     For examples:
  113.     inte(inte(F,x), y) is double integral of F with respect 
  114. to both variables x and y. 
  115.     d(d(y,x),t) is the mixed derivative of y with respect
  116. to x and t.
  117.     The keywords "from" "to" "step" "," are the same as separators
  118. in multi-arguement functions. e.g. inte(f(x), x, 0, 1) are the same as
  119. inte(f(x), x from 0 to 1).
  120.  
  121.        Examples:
  122. -------------------------------------------------------------------
  123. differentiation         d()             d(x^2,x)
  124. integration             inte()          inte(x^2,x)
  125. limit                   lim()           lim(sin(x)/x, x = 0)
  126. --------------------------------------------------------------------
  127.  
  128.         3.1.5.4  Test Functions
  129.  
  130.         Table 3.1.5.4.1  is*(x) Functions
  131. ---------------------------------------------------------------------
  132. Function                Meaning
  133.  
  134. isodd(x)                test if x is an odd number.
  135. iseven(x)               test if x is an even number.
  136. isinteger(x)            test if x is an integer number.
  137. isratio(x)              test if x is a rational number.
  138. isreal(x)               test if x is a real number.
  139. iscomplex(x)            test if x is a complex number.
  140. isnumber(x)             test if x is a number.
  141. islist(x)               test if x is a list.
  142. isfree(y,x)             test if y is free of x.
  143. issame(a,b)             test if a is the same as b.
  144. islarger(a,b)           test if a is larger than b.
  145. isless(a,b)             test if a is less than b.
  146. ----------------------------------------------------------------------
  147.         
  148. All of the is* functions give either 1 if it is true or 0 otherwise.
  149.  
  150.      The type(x) gives the type of x. Its value is a string.
  151.  
  152.                 Table 3.1.5.4.2  type(x) functions
  153. --------------------------------------------------
  154. x                   type(x)          
  155.  
  156. 1                   "integer"        
  157. 1.1                 "real"
  158. 2/3                 "ratio"
  159. 1+i                 "complex"
  160. sin(x)              "sin()"
  161. [1,2]               "[]"
  162. a                   "symbol"
  163. "a"                 "string"
  164. a+b                 "+"
  165. a*b                 "*"
  166. a^b                 "^"
  167. a=b                 "="
  168. a==b                "=="
  169. a>b                 ">"
  170. a>=b                ">="
  171. a<b                 "<"
  172. a<=b                "<="
  173. a<>b                "<>"
  174. a,b                 ","
  175. ---------------------------------
  176.  
  177.         You also can test x, e.g. if x is type of real number, by
  178. type(x)=="real".
  179.  
  180.         3.1.5.3  Miscellaneous Functions
  181.  
  182.         Table 3.1.5.3      Algebra Functions
  183. ---------------------------------------------------------------------
  184. expand(F)               expand (a+b)^2 to a^2 + 2*a*b + b^2.
  185. factor(F)               factorise a^2 + 2*a*b + b^2 to (a+b)^2.
  186. solve(f(x)=0, x)        solve polynomial and systems of linear
  187.             equations, or rearrange the equation.
  188. ---------------------------------------------------------------------
  189. Note: the Shareware Version has not solve().
  190.  
  191.     For example:
  192. -----------------------------------------------------------
  193. solving                 solve()         solve(x^2+1 = 0, x)
  194. expanding               expand()        expand((a+b)^2)         
  195. factoring               factor()        factor(a*c+b*c)         
  196. -----------------------------------------------------------
  197. where x is an undefined variable.
  198.  
  199.     Conversion functions convert a type of data to another
  200. type of data.
  201.  
  202.                 Table 3.1.5.4   Conversion Functions
  203. ---------------------------------------------------------------------
  204. listsum([a,b])          convert list to sum.
  205. coef(expr, x^2)         gives the coefficient of x^2 in expr.
  206. left(x^2=b)             left hand side of an equation.
  207. right(x^2=b)            right hand side of an equation.
  208. re(x)                   real part of complex numbers.
  209. im(x)                   imaginative part of complex numbers.
  210. num(x)                  convert x to the floating-point number.
  211. ratio(x)                convert x to the rational number.
  212. round(x)                convert x to the rounded integer.
  213. trunc(x)                convert x to the truncated integer.
  214. ----------------------------------------------------------------------
  215.  
  216.         Table 3.1.5.5     The List and Table Functions
  217. ----------------------------------------------------------------------
  218. list(f(x), x from xmin to xmax step dx)         lists of f(x).
  219. table(f(x), x from xmin to xmax step dx)        
  220.     data table of function values.
  221. ----------------------------------------------------------------------
  222.  
  223.     Above functions can be operated and chained, like the standard 
  224. functions. 
  225.  
  226.                3.1.5.5     User-defined Functions
  227.     You can define the new functions, which include the
  228. standard functions, calculus functions, and algebraic operators.
  229.     Define a new function f(x) by  
  230.         f(x_) := x^2
  231. and then call f(x) as the standard functions. The function name can 
  232. be any name, except for some keywords. (for the maximum number of
  233. arguments, see Chapter 7. System Limits).
  234.     Clears a variable or function from assignment by
  235.         clear(x)          # clear x from assignment.
  236.         clear(f(x))       # clear f(x) from assignment.
  237.         clear(a>0)        # clear a>0 from assignment.
  238.     Variables can be used in function definitions. It leads to 
  239. an important difference between functions and variables.  When a 
  240. variable is defined, all terms of the definition are evaluated.  When 
  241. a function is defined, its terms are not evaluated; they are evaluated 
  242. when the function is evaluated.  That means that if a component of the 
  243. function definition is changed, that change will be reflected the next 
  244. time the function is evaluated.
  245.